using System;

namespace SevenDigital.EndUserManagement.Core
{
	public class SecurityToken : IEquatable<SecurityToken>
	{
		#region ctor
		public SecurityToken()
			: this(null, String.Empty) {

		}
		public SecurityToken(DateTime? expirationDate, string resetToken) {
			ExpirationDate = expirationDate;
			ResetToken = resetToken;
		} 
		#endregion

		public virtual DateTime? ExpirationDate { get; private set; }
		public virtual string ResetToken { get; private set; }

		public bool Equals(SecurityToken other) {
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			return Equals(other.ExpirationDate, ExpirationDate) && Equals(other.ResetToken, ResetToken);
		}

		public override int GetHashCode() {
			return string.Format("{0}|{1}", ExpirationDate, ResetToken).GetHashCode();
		}

		public override bool Equals(object obj) {
			return Equals(obj as SecurityToken);
		}

	}
}